﻿///////////////////////////////////////////////////////////////////////////////
///
/// Cylan Client Core
/// Copyright (C) Shenzhen Cylan Tech. Co., Ltd. 2012
///
/// @file       Error.h
/// @brief      客户端核心库状态码表
///
///////////////////////////////////////////////////////////////////////////////
#ifndef CLIENTCORE_ERROR_H
#define CLIENTCORE_ERROR_H

#define CORE_ERROR_CATA                 0x00001000
#define CORE_ERROR_MASK                 0x00001FFF

#define SESSION_ERROR_CATA              0x00002000
#define SESSION_ERROR_MASK              0x00002FFF

#define TCP_ERROR_CATA                  0x00003000
#define TCP_ERROR_MASK                  0x00003FFF

#define ICAB_ERROR_CATA                 0x00004000
#define ICAB_ERROR_MASK                 0x00004FFF

#define IBOX_ERROR_CATA                 0x00005000
#define IBOX_ERROR_MASK                 0x00005FFF

#define IVIDEO_ERROR_CATA               0x00006000
#define IVIDEO_ERROR_MASK               0x00006FFF

#define TCP_TUNNELS_ERROR_CATA          0x00007000
#define TCP_TUNNELS_ERROR_MASK          0x00007FFF

#define TCP_WEB_ERROR_CATA              0x00008000
#define TCP_WEB_ERROR_MASK              0x00008FFF

#define NATIVE_RESOURCE_ERROR_CATA      0x00009000
#define NATIVE_RESOURCE_ERROR_MASK      0x00009FFF

#define SSO_RESOURCE_ERROR_CATA         0x0000A000
#define SSO_RESOURCE_ERROR_MASK         0x0000AFFF

#define ERR_SUCCESS                     0
#define ERR_UNSUCCESS                   1
#define ERR_NOT_IMPLEMENT               2
#define ERR_SYSCALL                     3
#define ERR_SGACALL                     4
#define ERR_NOMEM                       5
#define ERR_NOT_FOUND                   6
#define ERR_INVALID_PARAMETER           7
#define ERR_BUFFER_TOO_SMALL            8
#define ERR_ABORTED                     9
#define ERR_TIMEDOUT                    10

#define ERR_NETWORK_DNS                 100
#define ERR_NETWORK_CONNECT             101
#define ERR_NETWORK_TIMEDOUT            102
#define ERR_NETWORK_PROTOCOL            103
#define ERR_NETWORK_BLOCK               104
#define ERR_NETWORK_READ                105
#define ERR_NETWORK_WRITE               106

#define ERR_INVALID_SESSION             (CORE_ERROR_CATA | 1)
#define ERR_LOGIN_CERT_FILE             (CORE_ERROR_CATA | 2)
#define ERR_LOGIN_CERT_PIN              (CORE_ERROR_CATA | 3)
#define ERR_SERVER_ERROR                (CORE_ERROR_CATA | 4)

#define ERR_TCP_CONNECT_SGA             (TCP_ERROR_CATA | 1)
#define ERR_TCP_HANDSHAKE               (TCP_ERROR_CATA | 2)
#define ERR_TCP_SSL_CALL                (TCP_ERROR_CATA | 3)
#define ERR_TCP_SSL_INIT                (TCP_ERROR_CATA | 4)
#define ERR_TCP_SSL_CONNECT             (TCP_ERROR_CATA | 5)
#define ERR_TCP_CONNECT_SERVER          (TCP_ERROR_CATA | 6)
#define ERR_TCP_NO_RESOURCE             (TCP_ERROR_CATA | 7)

#define ERR_ICAB_DISCONNECT             (ICAB_ERROR_CATA | 1)
#define ERR_ICAB_UNDEFINED              (ICAB_ERROR_CATA | 2)
#define ERR_ICAB_MCS                    (ICAB_ERROR_CATA | 3)
#define ERR_ICAB_TLS                    (ICAB_ERROR_CATA | 4)
#define ERR_ICAB_AUTH                   (ICAB_ERROR_CATA | 5)
#define ERR_ICAB_CONFIG                 (ICAB_ERROR_CATA | 6)

#define ERR_IVIDEO_CONFIG               (IVIDEO_ERROR_CATA | 1)

#define ERR_IBOX_BAD_REQUEST            (IBOX_ERROR_CATA | 1)
#define ERR_IBOX_VERIFY_FAILED          (IBOX_ERROR_CATA | 2)
#define ERR_IBOX_NOT_MODIFIED           (IBOX_ERROR_CATA | 3)
#define ERR_IBOX_NOT_FOUND              (IBOX_ERROR_CATA | 4)
#define ERR_IBOX_FILEEXIST              (IBOX_ERROR_CATA | 5)
#define ERR_IBOX_ISDIR                  (IBOX_ERROR_CATA | 6)
#define ERR_IBOX_ISSHARE                (IBOX_ERROR_CATA | 7)
#define ERR_IBOX_DB_FAILED              (IBOX_ERROR_CATA | 8)
#define ERR_IBOX_FIELNAMEEXIST          (IBOX_ERROR_CATA | 9)
#define ERR_IBOX_NONEMPTYDIR            (IBOX_ERROR_CATA | 10)
#define ERR_IBOX_DELETEFAILED           (IBOX_ERROR_CATA | 11)
#define ERR_IBOX_CONFIG                 (IBOX_ERROR_CATA | 12)
#define ERR_IBOX_UNMOUNTED              (IBOX_ERROR_CATA | 13)
#define ERR_IBOX_FORBID					(IBOX_ERROR_CATA | 14)

#define ERR_TCP_TUNNELS_CONFIG          (TCP_TUNNELS_ERROR_CATA | 1)

#define ERR_TCP_WEB_CONFIG              (TCP_WEB_ERROR_CATA | 1)

#define ERR_NATIVE_RESOURCE_CONFIG      (NATIVE_RESOURCE_ERROR_CATA | 1)

#define ERR_SSO_CONFIG                  (SSO_RESOURCE_ERROR_CATA | 1)
/**
 * @typedef int CC_STATUS
 * @brief API执行结果状态码
 */
typedef int CC_STATUS;


/**
 * @fn const char *CCStatusToErrorString(CC_STATUS Status)
 * @brief 将错误码转化为错误码对应的宏字符串
 * @return 错误码宏字符串
 */
const char *CCStatusToErrorString(CC_STATUS Status);


#endif /* CLIENTCORE_ERROR_H */
